let t = require;
let  e = module
let  o =  e.exports;
 o.default =  e.exports;

                'use strict';
                console.log("start");
                var _n125,
                    i =
                    (this && this.__extends) ||
                    ((_n125 = function n(t, e) {
                            return (_n125 =
                                Object.setPrototypeOf ||
                                ({
                                        __proto__: []
                                    }
                                    instanceof Array &&
                                    function(t, e) {
                                        t.__proto__ = e;
                                    }) ||
                                function(t, e) {
                                    for (var o in e) {
                                        Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
                                    }
                                })(t, e);
                        }),
                        function(t, e) {
                            function o() {
                                this.constructor = t;
                            }
                            _n125(t, e),
                                (t.prototype =
                                    null === e ?
                                    Object.create(e) :
                                    ((o.prototype = e.prototype), new o()));
                        });
                Object.defineProperty(o, '__esModule', {
                        value: !0
                    }),
                    (o.MilitaryItemCom = void 0);
                var r = t('UIComponent'),
                    a = t('ComUtils'),
                    s = t('SoundMrg'),
                    c = t('BagMrg'),
                    l = t('GeneralTips'),
                    u = t('MilitaryMrg'),
                    h = t('LangCfg'),
                    p = t('MilitaryCfg'),
                    f = (function(t) {
                        function e(e) {
                            return t.call(this, e) || this;
                        }
                        return (
                            i(e, t),
                            (e.prototype.onInit = function() {
                                t.prototype.onInit.call(this),
                                    (this._txtLevel = a.default.getComponent(
                                        cc.Label,
                                        this.view,
                                        'txtLevel'
                                    )),
                                    (this._txtAttr = a.default.getComponent(
                                        cc.Label,
                                        this.view,
                                        'txtAttr'
                                    )),
                                    (this._txtCost = a.default.getComponent(
                                        cc.Label,
                                        this.view,
                                        'expense/txtValue'
                                    )),
                                    (this._imgManji = a.default.getNode(this.view, 'imgManji')),
                                    (this._btnUpgrade = a.default.getNode(
                                        this.view,
                                        'btnUpgrade'
                                    )),
                                    (this._redDot = a.default.getNode(
                                        this.view,
                                        'btnUpgrade/Background/redDot'
                                    )),
                                    this._btnUpgrade.on(
                                        cc.Node.EventType.TOUCH_END,
                                        this.onTouchUpgradeHandler,
                                        this
                                    ),
                                    (this._redDot.active = !1),
                                    c.BagMrg.ins.addCountEvent(
                                        c.BagMrg.GOLD,
                                        this.onGoldChanged,
                                        this
                                    );
                            }),
                            (e.prototype.onLang = function() {
                                var t = a.default.getComponent(
                                    cc.Label,
                                    this.view,
                                    'btnUpgrade/Background/txtLabel'
                                );
                                (t.string = h.LangCfg.ins.getContent(1018)),
                                ((t = a.default.getComponent(
                                    cc.Label,
                                    this.view,
                                    'imgManji/txtLabel'
                                )).string = h.LangCfg.ins.getContent(1019)),
                                this._data &&
                                    (this._txtAttr.string = this.getAttributeDesc(this._data));
                            }),
                            (e.prototype.onGoldChanged = function() {
                                this._data ?
                                    (this._redDot.active =
                                        c.BagMrg.ins.getCount(c.BagMrg.GOLD) >= this._data.money) :
                                    (this._redDot.active = !1);
                            }),
                            (e.prototype.onTouchUpgradeHandler = function() {
                                if (
                                    (s.SoundMrg.click(),
                                        c.BagMrg.ins.getCount(c.BagMrg.GOLD) >= this._data.money)
                                ) {
                                    var t = u.MilitaryMrg.ins.upgrade(
                                        this._data.type,
                                        this._data.kind,
                                        this._data.level
                                    );
                                    t &&
                                        (c.BagMrg.ins.useItem(c.BagMrg.GOLD, this._data.money),
                                            (this.data = t)),
                                        this.refresh();
                                } else l.GeneralTips.notEnoughGold();
                            }),
                            Object.defineProperty(e.prototype, 'data', {
                                set: function set(t) {
                                    (this._data = t), this.refresh();
                                },
                                enumerable: !1,
                                configurable: !0
                            }),
                            (e.prototype.refresh = function() {
                                var t;
                                this._data &&
                                    ((t = p.MilitaryCfg.ins.getDataByTypeAndKindAndLevle(
                                            this._data.type,
                                            this._data.kind,
                                            this._data.level + 1
                                        )),
                                        this._data &&
                                        ((this._txtLevel.string = 'Lv.' + this._data.level),
                                            (this._txtCost.string = this._data.money + ''),
                                            (this._txtAttr.string = this.getAttributeDesc(
                                                this._data
                                            )))),
                                    t ?
                                    ((this._imgManji.active = !1),
                                        (this._btnUpgrade.active = !0),
                                        (this._redDot.active =
                                            c.BagMrg.ins.getCount(c.BagMrg.GOLD) >=
                                            this._data.money)) :
                                    ((this._imgManji.active = !0),
                                        (this._btnUpgrade.active = !1),
                                        (this._redDot.active = !1));
                            }),
                            (e.prototype.getAttributeDesc = function(t) {
                                var e = '';
                                return (
                                    t.hp > 0 &&
                                    (e +=
                                        h.LangCfg.ins.getContent(1020, {
                                            n: t.hp
                                        }) + '\n'),
                                    t.atk > 0 &&
                                    (e +=
                                        h.LangCfg.ins.getContent(1021, {
                                            n: t.atk
                                        }) + '\n'),
                                    t.def > 0 &&
                                    (e +=
                                        h.LangCfg.ins.getContent(1022, {
                                            n: t.def
                                        }) + '\n'),
                                    t.crit > 0 &&
                                    (e +=
                                        h.LangCfg.ins.getContent(1023, {
                                            n: t.crit
                                        }) + '\n'),
                                    t.solid > 0 &&
                                    (e +=
                                        h.LangCfg.ins.getContent(1024, {
                                            n: t.solid
                                        }) + '\n'),
                                    t.hpPer > 0 &&
                                    (e +=
                                        h.LangCfg.ins.getContent(1025, {
                                            n: t.hpPer
                                        }) + '\n'),
                                    t.atkPer > 0 &&
                                    (e +=
                                        h.LangCfg.ins.getContent(1026, {
                                            n: t.atkPer
                                        }) + '\n'),
                                    t.defPer > 0 &&
                                    (e +=
                                        h.LangCfg.ins.getContent(1027, {
                                            n: t.defPer
                                        }) + '\n'),
                                    e.substring(0, e.length - 1)
                                );
                            }),
                            e
                        );
                    })(r.UIComponent);
                (o.MilitaryItemCom = f), console.log("end");
            module.exports =  e.exports;